feat(observability): add a prediction-calibration-drift alert rule for the miner - #5557
Conversation
…lert (JSONbored#5188) This commit introduces a new alert rule for monitoring the calibration drift of the gittensory miner's predictions. The alert, named GittensoryMinerPredictionCalibrationDrift, evaluates the ratio of incorrect to total resolved predictions over a 6-hour window, ensuring it remains dormant until a miner scrape target exists. Additionally, unit tests have been added to validate the alert's configuration and behavior, ensuring it references the correct metric names and maintains proper functionality.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5557 +/- ##
=======================================
Coverage 94.91% 94.91%
=======================================
Files 570 570
Lines 45351 45351
Branches 14675 14675
=======================================
Hits 43046 43046
Misses 1571 1571
Partials 734 734
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-13 05:12:54 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
gittensory-miner-predictiongroup toprometheus/rules/alerts.ymlwith a singlerule,
GittensoryMinerPredictionCalibrationDrift, that fires when the miner's predicted-gateaccuracy drifts out of tolerance. Built against the metric shape shipped by Wire the existing miner-prediction Prometheus renderer into a real command #4838/Build the missing calibration-report join #4849:
renderMinerPredictionMetrics(packages/gittensory-engine/src/miner-prediction-metrics.ts)emits
gittensory_miner_prediction_correct_total/_incorrect_total, and the rule uses thefraction of resolved predictions that came back incorrect.
LoopoverHighJobFailureRatiorule'sbad/(bad+good)ratio shape exactly,including the trailing
> 0denominator guard so a 0/0 (no resolved predictions, or an absentseries) degrades to silent instead of false-firing — the rule ships dormant and valid until
an operator configures a miner scrape target, the same way
loopover-d1-storagestays silentwithout the D1 probe.
0.5) and sustain window (for: 30m) are documented inline as the tunable knobs,following this file's established convention (there are no recording rules to hang a named
constant on); a wide
6hrate window smooths the miner's naturally sparse resolution cadence.Closes #5188.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run selfhost:validate-observability— dashboards and alert rules validnpm run docs:drift-checktest/unit/alerts-miner-prediction-calibration-drift.test.ts(new) + the existingalerts-job-failure-ratio-formula,docs-selfhost-troubleshooting-metric-names, andobservability-cisuites all passfor/severity,the real metric names (tied to the engine's exported constants so a rename fails the test),
the 0/0 silent-degradation invariant, and that it references no
loopover_*server metricIf any required check was skipped, explain why:
src/**code,so
codecov/patchhas nothing to instrument; no OpenAPI/MCP/UI/worker/migration surface changes,so those generators/gates are N/A.
Safety
UI Evidencesection. — N/A: alert-rule YAML + test only, no visible surface.alerts.ymlheader note was updated to stay accurate; no changelog edit.UI Evidence
N/A — this is an observability-config (
prometheus/rules/alerts.yml) + test change with no visible UI, frontend, docs page, or extension surface.Notes
gittensory-miner calibration) and the realemitted counters, so an operator can act on the alert without reading the YAML.
scope; this rule follows the file's current inline-documented-threshold convention.